package cn.shyouchi.wuguanjia.android.ui.event.temporary;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/10/28 at 10:44
 * Email: 472279981@qq.com
 * Des:
 */

public class TemporaryAdapter extends BaseQuickAdapter<TemporaryEntity.ResultMessageBean,BaseViewHolder> {

    TemporaryContract.View mView;
    public TemporaryAdapter(List<TemporaryEntity.ResultMessageBean> data, TemporaryContract.View view) {

        super(R.layout.item_event_temporary_layout, data);
        this.mView = view;
    }

    @Override
    protected void convert(BaseViewHolder holder, final TemporaryEntity.ResultMessageBean entity) {
        holder.setText(R.id.tv_temporary_name, entity.getProjectname());

        holder.setText(R.id.tv_temporary_time_range, String.format("%1s ~ %2s", entity.getStartingtime(), entity.getEndtime()));

        holder.getView(R.id.item_layout).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onItemClick(entity);
            }
        });

        holder.getView(R.id.btn_del).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onDelClick(entity);
            }
        });

    }
}
